package com.example.ioc1;

import com.example.ioc1.controller.HelloController;
import com.example.ioc1.controller.UserController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;


@SpringBootApplication
public class SpringIoc1Application {
    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringIoc1Application.class, args);

        UserController bean = (UserController) context.getBean("usercon");
        bean.sayHi();

//        HelloController bean = context.getBean(HelloController.class);
//        bean.sayHi();
//        System.out.println(bean);
////
//        HelloController helloController = (HelloController)context.getBean("helloController");
//        helloController.sayHi();
//        System.out.println(helloController);
//
//        HelloController helloController1 = context.getBean("helloController", HelloController.class);
//        helloController1.sayHi();
//        System.out.println(helloController1);

//        UController bean = (UController)context.getBean("UController");
//        bean.sayHi();
//        UController bean1 = context.getBean(UController.class);
//        bean1.sayHi();
//        UController bean2 = context.getBean("UController", UController.class);
//        bean2.sayHi();

//        UserService bean6 = context.getBean(UserService.class);
//        bean6.doService();
//        UserComponent bean1 = context.getBean(UserComponent.class);
//        bean1.doComponent();
//        UserComponent bean2 = (UserComponent) context.getBean("userComponent");
//        bean2.doComponent();
//        UserConfig bean3 = context.getBean(UserConfig.class);
//        bean3.doConfig();
//        UserRepo bean4 = context.getBean(UserRepo.class);
//        bean4.doRepo();


//        UserInfo bean =(UserInfo) context.getBean("UCinfo");
//        System.out.println(bean);
    }

}
